<?php
session_start();
$userId=$_SESSION['userId'];
$user=$model->searchUserById($userId);
$username = $user->getUserAccName();
$date = date("Y-m-d H:i:s");
$log = $date."---Event---".$username."---Logout\n";
$path="../log/log.txt";
$file=fopen($path, "a");
$write=fwrite($file,$log);
fclose($file);
session_destroy();
header('Location:../index.php');
?>